package com.bds.btcdc.adapter.huobi.market.http;

import com.bds.btcdc.http.HttpUtil;
import com.bds.btcdc.util.Const;
import org.junit.jupiter.api.Test;

import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class TestProxy
{
    @Test
    public void huobi() throws Exception{
        HttpUtil httpUtil = HttpUtil.getInstance();
        String param = "?symbol=btcusdt";
        Map<String, String> header = new HashMap<>();
        header.put("User-Agent",
                "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36");
        String json = httpUtil.get(Const.HUOBI.URL + Const.HUOBI.WS_MARKET_INFO + param, header, false);
        System.out.println(json);
    }

    @Test
    public void index(){
        List list=new ArrayList();
        list.add("a");
        list.add("b");
        System.out.println(list.indexOf("b"));
    }

    @Test
    public void decimal(){
        DecimalFormat df = new DecimalFormat("#0.00");
//        BigDecimal bd=new BigDecimal(0.000082150000000000);
        BigDecimal bd=new BigDecimal(5453.403082150000000000);
        System.out.println(bd);
        String d=df.format(bd);
        System.out.println(d);
    }


    @Test
    public void bitstamp() throws Exception{
        String TICKER = "ticker/";
        String url = Const.BITSTAMP.URL + TICKER + "ethbtc";
            HttpUtil httpUtil = HttpUtil.getInstance();
            String jsonStr = httpUtil.get(url, null, false);
    }
}
